package nz.ac.massey.doi_information_extractor.gui;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.UIManager;

import nz.ac.massey.doi_information_extractor.data.Author;
import nz.ac.massey.doi_information_extractor.data.Publication;

/**
 * AbstractGui - Interface for the graphical user interface
 */
@SuppressWarnings("serial")
public abstract class AbstractGui extends JFrame{

	/**
	 * Constructor for user interface
	 * @param main The main thread that will handle the events from the user interface
	 */
	public AbstractGui(){
		try {
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			JOptionPane.showConfirmDialog(this, "Cannot open Nimbus look and feel, using standard settings.");
		}
		this.setResizable(false);
		initComponents();
	}

	/**
	 * Get the publication currently being displayed on the GUI
	 * @return
	 */
	public abstract Publication getPublication();

	/**
	 * Sends  a publication to the GUI to display
	 * @param publication The publication to Display
	 */
	public abstract void setPublication(Publication publication);

	/**
	 * Method to initialise the components of the user interface
	 */
	protected abstract void initComponents();

	/**
	 * Gets the DOI used for a search from the user interface
	 * @return The DOI to search for
	 */
	public abstract String getDoi();

	/**
	 * Returns the Author object corresponding to the selected index of the authors JList on the gui
	 * @return The selected author object
	 */
	public abstract Author getSelectedAuthor();

	/**
	 * Sets the selected index of the authors JList to the Author object
	 * @param author The author to set
	 */
	public abstract void setSelectedAuthor(Author author);

	public abstract JProgressBar getProgressBar();
}
